package service.serviceimpl;

import dao.UpdateUsersDao;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import service.UpdateUsersService;

import javax.annotation.Resource;

@Transactional
@Service("usersService")
public class UpdateUsersServiceImpl implements UpdateUsersService {
     @Resource
    private UpdateUsersDao updateUsersDao;

    public UpdateUsersDao getUpdateUsersDao() {
        return updateUsersDao;
    }

    public void setUpdateUsersDao(UpdateUsersDao updateUsersDao) {
        this.updateUsersDao = updateUsersDao;
    }

    @Override
    @Transactional(propagation = Propagation.REQUIRED)
    public boolean upaatepassword(int id, String username, String password) {
        // TODO Auto-generated method stub
        boolean flag = false;
        try{
            if(updateUsersDao.updatePassword(id,username,password) > 0)
                flag = true;
        }catch (Exception e) {
            // TODO: handle exception
            e.printStackTrace();
        }finally{
        }
        return flag;
    }
}
